import { TextureLoader } from "../../thirdparty/three/imports";
import { Texture3D } from "../textures/Texture3D";

export class TextureLoader3D
{
    load(url: string, onLoad?: (texture: Texture3D) => void, onProgress?: (event: ProgressEvent<EventTarget>) => void, onError?: (event: ErrorEvent) => void)
    {
        const _texture = new TextureLoader().load(url, (texture) =>
        {
            if (onLoad)
            {
                const texture3D = Texture3D.get(texture);
                onLoad(texture3D);
            }
        }, onProgress, onError);

        const texture3D = Texture3D.get(_texture);

        return texture3D;
    }
}
